money = 5000000
name = input("请输入客户姓名：")
def menu():
    print("--------------主菜单--------------")
    print(f"{name}，您好，欢迎来到黑马银行ATM。请选择操作：\n查询余额  [输入1]\n存款  [输入2]\n取款  [输入3]\n退出  [输入4]")
    return int(input("请输入您的选择："))
def check_balance(show_header):
    if show_header:
        print("--------------查询余额--------------")
    print(f"{name},您好，您的余额剩余{money}元")
def deposit(put_in):
    global money
    money += put_in
    print("--------------存款--------------")
    print(f"{name}，您好，您存款{put_in}元成功")
    check_balance(False)
def withdrawal(take_out):
    global money
    money -= take_out
    print("--------------取款--------------")
    print(f"{name}，您好，您取款{take_out}元成功")
    check_balance(False)

while True:
    choose= menu()
    if choose == 1:
        check_balance(True)
    elif choose == 2:
        put_in = int(input("输入要存入的金额："))
        deposit(put_in)
    elif choose == 3:
        take_out = int(input("输入要取出的金额："))
        withdrawal(take_out)
    elif choose == 4:
        print("退出成功")
        break
    else:
        print("未知数字，自动退出")
        break